<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:p="http://primefaces.org/ui"
      xmlns:f="http://java.sun.com/jsf/core">
<h:head>
	<title>nested consult</title>
	<meta http-equiv="content-type" content="text/html;charset=utf-8"/>
</h:head>
<h:body>
	<f:facet name="last">
		<h:outputStylesheet name="css/style.css" />
    </f:facet>
	<h:form>
    
     
    	<p:megaMenu>
			<p:menuitem value="Главная" url="http://localhost:8080/nesteDDevelopment/main.jsf" icon="ui-icon-document" />
			<p:menuitem value="Участники" url="http://localhost:8080/nesteDDevelopment/users.jsf" icon="ui-icon-pencil" />
			<p:menuitem value="Дистрибьюторы" url="http://localhost:8080/nesteDDevelopment/distrs.jsf" icon="ui-icon-contact" />
		</p:megaMenu>
		
		<p:panel id="panel" header="Новый участник">
		<h:panelGrid columns="3">
			<h:outputLabel value="Фамилия :" for="lastname" />
			<p:inputText value="#{usersBean.newUserLastname}" 
				id="lastname"
				required="true" 
	    		requiredMessage="Введите фамилию" 
	    		/>
			<p:message for="lastname" />
			
			<h:outputLabel value="Имя :" for="firstname" />
			<p:inputText value="#{usersBean.newUserFirstname}" 
				id="firstname"
				required="true" 
	    		requiredMessage="Введите имя" 
	    		/>
			<p:message for="firstname" />
			
			<h:outputLabel value="Отчество :" for="patronymic" />
			<p:inputText value="#{usersBean.newUserPatronymic}" 
				id="patronymic"
				required="true" 
	    		requiredMessage="Введите отчество" 
	    		/>
			<p:message for="patronymic" />
			
			<h:outputLabel value="Компания :" for="company" />
			<p:inputText value="#{usersBean.newUserCompany}" id="company"
				required="true" 
	    		requiredMessage="Введите должность" 
	    		/>
			<p:message for="company" />
			
			<h:outputLabel value="Должность :" for="post" />
			<p:inputText value="#{usersBean.newUserPost}" id="post"
				required="true" 
	    		requiredMessage="Введите должность" 
	    		/>
			<p:message for="post" />
			
		</h:panelGrid>
				
		<p:commandButton value="Добавить" action="#{usersBean.add}" ajax = "false"/>
			
		</p:panel>
			
		<p:dataTable id="tbl" 
			var="usrs" 
			value="#{usersBean.users}">
			
			<p:column>
        		<f:facet name = "header">
        			<h:outputText value="Идентификатор"/>
            	</f:facet>
            	<h:outputText value="#{usrs.key}" />
        	</p:column>
		
        	<p:column>
        		<f:facet name = "header">
        			<h:outputText value="Имя"/>
            	</f:facet>
            	<h:outputText value="#{usrs.firstname}" />
        	</p:column>
			
			<p:column>
        		<f:facet name = "header">
        			<h:outputText value="Отчество"/>
            	</f:facet>
            	<h:outputText value="#{usrs.patronymic}" />
        	</p:column>
        	
        	<p:column>
        		<f:facet name = "header">
        			<h:outputText value="Фамилия"/>
            	</f:facet>
            	<h:outputText value="#{usrs.lastname}" />
        	</p:column>
        	
        	<p:column>
        		<f:facet name = "header">
        			<h:outputText value="Компания"/>
            	</f:facet>
            	<h:outputText value="#{usrs.company}" />
        	</p:column>
        	
        	<p:column>
        		<f:facet name = "header">
        			<h:outputText value="Должность"/>
            	</f:facet>
            	<h:outputText value="#{usrs.post}" />
        	</p:column>
        
    </p:dataTable>
			
								
		
		
</h:form>
</h:body></html>